<template>
  <ElDrawer v-model="visible" :with-header="false" direction="ttb" size="80%" :lock-scroll="false">
    <!-- <span>{{ purchaseBill }}</span> -->
    <div class="content">
      <ReadOnlyPurchase :purchase-bill="purchaseBill">
        <template #auditMsg>
          <ElInput v-model="purchaseBill.auditMsg"></ElInput>
          <!-- <ElInput type="textarea" v-model="purchaseBill.auditMsg"></ElInput> -->
        </template>
      </ReadOnlyPurchase>
      <ElButton type="primary" @click="audit()"> 审核通过 </ElButton>
      <ElButton type="success" @click="resent()"> 打回重交 </ElButton>
    </div>
  </ElDrawer>
</template>
<script lang="ts">
import { PurchaseBill } from '@/entity/purchase.entity'

/**
 * 页面核心数据结构体说明文档
 *
 *
 */
// import from

export default defineComponent({
  name: 'PurchaseAudit',
  emits: ['postAudit'],
  props: {
    sampleP: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      sampleD: 'value',
      visible: false,
      purchaseBill: {} as PurchaseBill
    }
  },
  computed: {
    /* sampleC() {
      return this.sampleD + "--";
    }, */
  },
  created() {},
  mounted() {},
  methods: {
    // sampleM() {},
    show(data: PurchaseBill) {
      this.purchaseBill = data
      // data.applier
      this.visible = true
    },
    async audit() {
      const res = await axios({
        method: 'put',
        url: '/purchase/audit',
        data: this.purchaseBill
      })
      this.visible = false
      this.$emit('postAudit', 1)
    },
    async resent() {
      const res = await axios({
        method: 'put',
        url: '/purchase/resent',
        data: this.purchaseBill
      })
      this.visible = false
      this.$emit('postAudit', 1)
    }
  },
  watch: {
    // sampleP(n, o) {},
  }
})
</script>

<!--<style scoped>-->
<style lang="scss" scoped>
.content {
  width: 1200px;
  margin-left: 120px;
}
</style>
